package main.java.FSMDE.validation.rules;

import java.util.ArrayList;
import java.util.List;

import main.java.FSMDE.models.Component;
import main.java.FSMDE.models.ComponentType;
import main.java.FSMDE.models.Diagram;
import main.java.FSMDE.models.Interface;
import main.java.FSMDE.validation.IValidationEntry;
import main.java.FSMDE.validation.rules.IRulesValidator;


public class GenericComponentTypeValidator implements IRulesValidator {

	@Override
	public Iterable<IValidationEntry> validate(Diagram diagram) {
		List<IValidationEntry> entries = new ArrayList<IValidationEntry>();
		for (Interface inface : diagram.getInterfaces()) {
			for (Component component : inface.getComponents()) {
				if(component.getType().equals(ComponentType.Generic)){
					if(component.getGenericType().equals("")) entries.add(new GenericComponentTypeValidationEntry(diagram, inface, component));
				}
			}
		}
		return entries;
		
	}

}
